#ifndef SERVER_MAINWINDOW_H
#define SERVER_MAINWINDOW_H

#include <QtGui>
#include <QtGui/QMainWindow>
#include "ui_server_mainwindow.h"
#include <QStandardItem>
#include <QMainwindow>
#include <QStandardItemModel>

#include "server_subwindow1.h"
#include "server_subwindow2.h"
#include "server_subwindow3.h"
#include "server_subwindow4.h"
#include "server_subwindow5.h"
#include "dbconfig_window.h"
#include "tree.h"
#include "nr_object_manager.h"


class server_mainwindow : public QMainWindow
{
	Q_OBJECT

public:
	server_mainwindow(QWidget *parent = 0, Qt::WFlags flags = 0);
	~server_mainwindow();

private:
	Ui::server_mainwindowClass ui;

// signals:
//     void triggered_createDeviceItem(QTreeWidgetItem *item);
//     void triggered_createDeviceGroup(QTreeWidgetItem *item);
	
	private slots:
		void on_QTreeWidgetChildItem_Clicked(QTreeWidgetItem *item, int column);
        void on_TreeWidget_Pressed(QTreeWidgetItem *item, int column);
        void on_CreateDeviceItem();
        void on_CreateDeviceGroup();
        void on_UpdateDeviceXMLandTree();
        void on_DBConfig_Options();

private:
    void initialize_TreeWidget();
    void save_DeviceItems_ToXML(const QString& xml_file);
    void on_TreeItemLeftClicked(QTreeWidgetItem *item, int column);
    void on_TreeItemRightClicked(QTreeWidgetItem *item, int column);


private:
    nr_object_manager &m_object_manager;
    SetTreewidget *m_treeWidget;
    //server_subwindow1 *m_server_subwindow;
    QWidget* m_last_mdiArea_Widget;
    QTreeWidgetItem* m_currentTreeWidgetItem;

    QAction* m_Act_createDeviceItem; 
    QAction* m_Act_createDeviceGroup;
    QMenu *m_Rmenu_1;
    QMenu *m_Rmenu_2;
};

#endif // SERVER_MAINWINDOW_H
